home *** CD-ROM | disk | FTP | other *** search
/ Compute! Gazette 1989 April / 1989-04.d64 / golf handicap (.txt) < prev    next >
Commodore BASIC  |  2022-09-20  |  2KB  |  50 lines

  1. 5 print"[147]":poke53281,6:poke53280,14:poke646,14
  2. 10 dim s(20),l(12):cr=68:print"[147]golf handicap calculator"
  3. 20 input"enter player's name";pn$:if pn$="" then print"[145][145]";:goto20
  4. 30 f$=left$(pn$,12)+".dat"
  5. 40 open 2,8,2,f$:open15,8,15:input#15,a$,b$:close15
  6. 50 if a$="62" then close2:gosub340:goto100
  7. 60 close2:open 2,8,2,f$:vm=20.1
  8. 70 for i=1 to 20:input#2,s(i):if s(i)<0 then vm=i:i=20
  9. 80 next i:close2:if vm=20.1 then vm=20:for i=0 to 19:s(i)=s(i+1):next
  10. 90 input"enter new score";s(vm):if vm<20 then s(vm+1)=-1
  11. 100 q=1:l(1)=s(1):qm=11:if vm<qm then qm=vm
  12. 110 for i=2 to vm
  13. 120 for j=1 to q
  14. 130 if s(i)<l(j) then for k=q to j step-1:l(k+1)=l(k):next:l(j)=s(i):j=q+10
  15. 140 next j:q=q+1:if q>qm then q=qm
  16. 150 if j<=q then l(q)=s(i)
  17. 160 next i
  18. 170 if vm=20 then print"the last twenty scores:":goto190
  19. 180 print""vm"scores:"
  20. 190 fori=1 to vm:prints(i);"[157]";:if i=10 then print
  21. 200 next:print
  22. 210 t=0:print"low scores used in computation:"
  23. 220 if vm<5 then print"5 or more scores needed for handicap.":goto280
  24. 230 if vm<17 then m%=1+(vm-5)/2
  25. 240 if vm>16 then m%=vm-10
  26. 250 for i=1 to m%:print l(i)"[157]";:t=t+l(i)-cr:next:t=t/m%*10:h=int(t*.096+.5)
  27. 260 print:print"handicap:";:ifh<0thenprint" +";
  28. 270 printabs(h)
  29. 280 print"save to disk (y/n)?":gosub460
  30. 290 if r=0 then330
  31. 300 open 15,8,15:print#15,"s0:";f$:close15
  32. 310 open 2,8,1,f$
  33. 320 for i=1 to vm:print#2,s(i):next:print#2,-1:close2
  34. 330 end
  35. 340 print"a new player"
  36. 350 print"enter "pn$"'s last twenty scores"
  37. 360 print"if you don't have 20, enter -1 after    last score"
  38. 370 for v=1 to 20:input s(v)
  39. 380 vm=v:if s(v)=-1 then vm=v-1:v=20
  40. 390 next
  41. 400 print"[147]"pn$"'s last"vm"scores:"
  42. 410 for i=1 to vm:print "#"i"  score"s(i):next
  43. 420 print"are these scores okay (y/n)?":gosub460
  44. 430 if r then return
  45. 440 input"enter # of bad score";n:if n<1 or n>vm then print"[145]";:goto440
  46. 450 print"correct #";n;:input s(n):goto400
  47. 460 geta$:if a$="y" then r=1:return
  48. 470 if a$="n" then r=0:return
  49. 480 goto460
  50.